package com.tian.controller;

import com.tian.pojo.Doctors;
import com.tian.service.DoctorsService;
import com.tian.vo.PageResult;
import com.tian.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/doctors")
@CrossOrigin
public class DoctorsController {
    @Autowired
    private DoctorsService doctorsService;


    @GetMapping("/list")
    public SysResult getUserList(PageResult pageResult){
        pageResult = doctorsService.getList(pageResult);
        return SysResult.success(pageResult);
    }

    @DeleteMapping("/delete/{id}")
    public SysResult deleteById(@PathVariable Integer id){
        doctorsService.deleteById(id);
        return SysResult.success();
    }


    //王佳政
    @GetMapping("/findDoctorList/{hospital}")
    public SysResult findDoctorList(@PathVariable String hospital){
        List<Doctors> doctorList = doctorsService.findDoctorList(hospital);
        return SysResult.success(doctorList);
    }
}
